import {httprequests} from '@/miniprogram/utils/httpReq'
import { getstorage } from '../storage'
///carts addToCarts skuId num

export const addcarts = (data) =>{
    return httprequests("carts/addToCarts","GET",{
        skuId:data.skuId,
        num:data.num
    },
    {'Cookie':getstorage('token')}
    )
}

//查询购物车
export const getCartList = () =>{
    return httprequests('carts/getCartListFromRedis','GET','',
        {'Cookie':getstorage('token')}
    )
}
/**
 * skuId
 * count
 * selectStatus
 * @param {*} data 
 */
export const changeCount = (data) =>{
    return httprequests('carts/changeCount','POST',data,
        {'Cookie':getstorage('token')})
}
/**
 * 删除购物车
 * carts/deleteCartItemBySkuId?skuId=100
 */
 export const deleteCartCount = (data)=>{
     return httprequests('carts/deleteCartItemBySkuId','GET',{
         skuId:data.skuId
     },{'Cookie':getstorage('token')}
     )
 }

//改变购买选中状态
 export const changeStatus = (data) =>{
     return httprequests('carts/changeStatusBySkuId','GET',{
         skuId:data.skuId,
         selectStatus:data.selectStatus
        },{
         'Cookie':getstorage('token')
     })
 }

 //改变全选状态

 export const changeCheckAll =(data) =>{
     return httprequests('carts/changeCheckAllStatus','GET',
     {
        checkAll:data.checkAll
    },
        {
         'Cookie':getstorage('token')
     })
 }


 //购物车提交订单
 export const submitCar = () =>{
     return httprequests('/oms-order/OrderConfirm')
 }
